package com.sptpc.company.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sptpc.company.common.ServerResponse;
import com.sptpc.company.pojo.Article;
import com.sptpc.company.pojo.User;
import com.sptpc.company.service.IArticleService;

@Controller
@RequestMapping("/article/")
public class ArticleController {
	
	@Autowired
	private IArticleService iArticleService;
	
	//查询商品
	@RequestMapping(value="seek.do", method=RequestMethod.POST)
	@ResponseBody
	public ServerResponse seek(int id,HttpSession session){
		return iArticleService.seek(id,session);
	}
	
	//插入商品
	@RequestMapping(value="insertseek.do", method=RequestMethod.POST)
	@ResponseBody
	public ServerResponse<String> insertseek(String aname,String content,String price,HttpSession session) {
		return iArticleService.insertseek(aname,content,price,session);
	}
	
	//删除商品
	@RequestMapping(value="delet.do", method=RequestMethod.POST)
	@ResponseBody
	public ServerResponse delet(int id,HttpSession session) {
		return iArticleService.delet(id,session);
	}
	
	//更新商品
	@RequestMapping(value="update.do", method=RequestMethod.POST)
	@ResponseBody
	public ServerResponse update(Integer id,String aname,String content,HttpSession session) {
		return iArticleService.update(id,aname,content,session);
	}

}
